 <%--
 *  File:   PurchaseDetail.jsp
 *  Desc:	the Lend slip summary page
 *
 *  Date		  Author		  Changes
 *  2011-1-22	  KevinFan		  Created
 *
 *  Copyright (C) 2000 - 2011 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%
  //init param
  String privilegeCode = "ALL";
  String strTableName = "v_zylpurchasedetailsummary";
  String strModuleName = "TDR";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ include file="/inc/OvalLocationDefault.inc" %>

<html>
<head>
<title>PharmacyPurchaseVerify</title>
<PageFlow:CheckPageFlow pageName="p_zylpurchasedetailsummary"/>
<%@ include file="/inc/CatchError.inc" %>
<%@ include file="/inc/SumDiv.inc" %>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript">
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "PurchaseDetail.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function clickRow(obj,idx)
{
  var cform = document.cform;
  cform.radiorow[idx].checked=true;
  cform.lendslipid.value = eval('obj.all.lendslipid'+idx).value;
  cform.status.value = eval('obj.all.status'+idx).value;
}

</script>
</head>
<%Integer businesstype = (Integer)pageContext.getAttribute("businesstype"); %>
<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_zylpurchasedetailsummary">
    <input type="hidden" name="actionname">
    <input type="hidden"" name="businesstype" value="<%= businesstype %>"/>
    <custom:hidden property="year"/>
    <custom:hidden property="month"/>
    <custom:hidden property="orgid"/>
    <custom:hidden property="partnerid"/>
    <custom:hidden property="productid"/>
    <custom:hidden property="regionid"/>
    <custom:hidden property="userids"/>
    <custom:hidden property="proviceofficecode"/>
    <custom:hidden property="businessareacode"/>
<%--  page location   --%>
    <%@ include file="/inc/PageLocation.inc" %>
    <table width="100%" cellspacing="0" border="0" cellpadding="0">
      <tr>
<%--  search criteria  --%>
      </tr>
      <tr>
        <td>
          <table width="100%" border="0" cellspacing="0"><!--
            <%@ include file="/inc/SummarySearch.inc" %>
          --></table>
        </td>
      </tr>
      <tr>
        <td>
          <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
			<%
			    ArrayList titleTdArray = new ArrayList();
			    titleTdArray.add(new TD("1%","&nbsp;"));
			  //titleTdArray.add(new TD("22","<input type=\"checkbox\" onclick=''"));
			    titleTdArray.add(new TitleTD("10%","L_BuyDate","businessdate") );
			    titleTdArray.add(new TitleTD("7%","L_OrganizationCode","vendorcode"));
			    titleTdArray.add(new TitleTD("18%","L_DealerName","vendorname"));
			    if(businesstype.intValue() == 140){
				    titleTdArray.add(new TitleTD("10%","L_PharmacyCode","dealercode"));
				    titleTdArray.add(new TitleTD("15%","L_PharmacyName","dealername"));
			    }else if(businesstype.intValue() == 160){
				    titleTdArray.add(new TitleTD("10%","L_HospitalCode","dealercode"));
				    titleTdArray.add(new TitleTD("15%","L_HospitalName","dealername"));
			    }
			    titleTdArray.add(new TitleTD("5%","L_FolwQty","flowqty"));
			    titleTdArray.add(new TitleTD("5%","L_NotFolwQty","notflowqty"));
			    titleTdArray.add(new TitleTD("5%","L_PurchaseQty","allqty"));
			 %>
			    <custom:titletr styleClass="deepblue-left" tdArray="<%=titleTdArray%>" />
			
			
			 <%
			     ArrayList detailTdArray = new ArrayList();
			     detailTdArray.add(new RadioTD());
			   //detailTdArray.add(new CheckBoxTD("id"));
			     detailTdArray.add(new WriteTD("businessdate"));
			     detailTdArray.add(new WriteTD("vendorcode"));
			     detailTdArray.add(new WriteTD("vendorname"));
			     detailTdArray.add(new WriteTD("dealercode"));
			     detailTdArray.add(new WriteTD("dealername"));
			     detailTdArray.add(new WriteTD("flowqty"));
			     detailTdArray.add(new WriteTD("notflowqty"));
			     detailTdArray.add(new WriteTD("allqty"));
			 %>
		  <custom:iteratetr tdArray="<%=detailTdArray%>" dataSource="totalsummary"/>
			<%@ include file="/inc/SummaryAction.inc" %>
          </table>
        </td>
      </tr>
    </table>
</form>
</body>
</html>
